package api;
//自定义一个盒子类型
class Box<T>{
    private T element;
    public void setElement(T element){
        this.element = element;
    }
    public T getElement(){
        return element;
    }
}
public class GenericTest {


    public static void main(String[] args) {
        //使用泛型
        Box<String> box = new Box<>();
        box.setElement("10");
        String a = box.getElement();
        System.out.println(a);
        Box<Integer> box1 = new Box<>();
        box1.setElement(12);
        Integer b = box1.getElement();
        System.out.println(b);
    }
}
